package com.cfl.ticket.feign;

import java.util.ArrayList;

import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cfl.model.City;
import com.cfl.model.Ticket;
import com.cfl.model.TicketNumber;
import com.cfl.ticket.fallback.TicketFeignFallback;
import com.cfl.utils.AppResponse;

@FeignClient(name="ticketcloud-ticket-module", fallback=TicketFeignFallback.class)
public interface TicketFeign {

	/**
	 * 获取我的车票
	 * @param uid
	 * @param page
	 * @return
	 */
	@RequestMapping(value="find_my_tickets")
	public ArrayList<Ticket> findMyTickets(@RequestParam("uid")String uid, @RequestParam("page")Integer page);
	
	/**
	 * 获取车次
	 * @param number
	 * @return
	 */
	@RequestMapping(value="find_ticketnumber_number")
	public TicketNumber findTicketnumber(@RequestParam("number")String number);
	
	/**
	 * 获取车次
	 * @param tid
	 * @return
	 */
	@RequestMapping(value="findTicketnumberByTid")
	public TicketNumber findTicketnumberByTid(@RequestParam("tid")String tid);
	
	/**
	 * 获取所有车次
	 * @return
	 */
	@RequestMapping(value="findTicketnumberByAll")
	public ArrayList<TicketNumber> findTicketnumberByAll();

	/**
	 * 获取城市
	 * @param name 城市名称
	 * @return
	 */
	@RequestMapping(value="findCityByName")
	public City findCityByName(@RequestParam("name")String name);
	
	/**
	 * 获取城市
	 * @param cid
	 * @return
	 */
	@RequestMapping(value="findCityByCid")
	public City findCityByCid(@RequestParam("cid")String cid);
	
	/**
	 * 获取所有城市
	 * @return
	 */
	@RequestMapping(value="findCityByAll")
	public ArrayList<City> findCityByAll();

//	/**
//	 * 添加车票
//	 * @param startCity
//	 * @param endCity
//	 * @param DriveTimeText
//	 * @param number
//	 * @param seat
//	 * @param seatType
//	 * @param sellCity
//	 * @param uid
//	 * @param buyName
//	 * @param price
//	 * @return
//	 */
//	@RequestMapping(value="add_ticket")
//	public AppResponse addTicket(@RequestParam("startCity")String startCity, @RequestParam("endCity")String endCity, @RequestParam("driveTimeText")String DriveTimeText,
//			 @RequestParam("number")String number, @RequestParam("seat")String seat, @RequestParam("seatType")String seatType, @RequestParam("sellCity")String sellCity, 
//			 @RequestParam("uid")String uid, @RequestParam("buyName")String buyName, @RequestParam("price")String price);
	
	@RequestMapping(value="add_ticket")
	public Boolean addTicket(@RequestParam("ticket")Ticket ticket);
	
}
